{template admin/header}
{template admin/event_header}

<div>
<form action="admin.php?mod=event&code=addevent&act=$act" method="POST">
  <table width=100% cellspacing=1 cellpadding=3>
    <tr>
      <td>活动主题:</td>
    </tr>
    <tr> 
      <td> 
        <textarea name="name" cols="25" rows="5"></textarea>
        <font color="#FF0000">注意:</font>可以同时创建多个栏目,每个栏目换一行即可.
      </td>
    </tr>
    <tr> 
      <td> 
        <input type=submit value="提交" name="create" class="button">
      </td>
    </tr>
  </table>
</form>
</div>

<!-- {if $event} -->
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableborder">
  <tr class="header">
    <td width=30%>活动主题</td>
    <td width="20%">活动数</td>
    <td width=10%>删除</td>
  </tr>
<!-- {loop $event $key $val} -->
  <tr>
    <td class="altbg1" style="border-bottom:1px dashed #ccc">{$val[type]}</td>
    <td class="altbg1" style="border-bottom:1px dashed #ccc">
    	{$val[count]}
      <input type="hidden" id="hid_count_{$key}" name="hid_count_{$key}" value="{$val[count]}">
    </td>
    <td class="altbg1" style="border-bottom:1px dashed #ccc">
      <a href="admin.php?mod=event&code=delevent&id=$key" onclick="return del($key);">删除</a>
    </td>
  </tr>
<!-- {/loop} -->
<!-- {/if} -->
</table>
<script type="text/javascript">
  function del(key){
	  var count = document.getElementById('hid_count_'+key).value;
	  if(count == 0){
		  return confirm('你确实要删除吗?不可恢复');
	  }else{
		  alert('该主题下有活动，不能删除');
		  return false;
	  }
  }
</script>
